/*
 * File name: CRecognition.h
 * Date:      2010
 * Author:   Tom Krajnik 
 */

#ifndef __CRECOGNITION_H__
#define __CRECOGNITION_H__

#include "CRawImage.h"
#include <math.h>

typedef struct{
	int x;
	int y;
}SPixelPosition;

#define MAX_SEGMENT 1000

class CRecognition
{
public:
  CRecognition();
  ~CRecognition();

  int findPath(CRawImage* image,int* pathWidth,int* pathCenter);
  void learnPixel(unsigned char* a);
  void increaseTolerance();
  void decreaseTolerance();

private:
  int tolerance;  

  int evaluatePixelHsv(unsigned char* a);
  int evaluatePixelGray(unsigned char* a);
  int evaluatePixel(unsigned char* a);
  
  void rgbToHsv(unsigned char r, unsigned char g, unsigned char b, unsigned int *h, unsigned char *s, unsigned char *v);
  void rgbToGray(unsigned char r, unsigned char g, unsigned char b, unsigned char *gray);

  unsigned char learned[3];
  unsigned int learnedHue;
  unsigned char learnedSaturation,learnedValue;
  char colorArray[64*64*64];
};

#endif

/* end of CRecognition.h */
